package com.aop.proxy;

import com.aop.service.UserService;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author xinwang
 * @date 2020/2/22 18:16
 **/
@Transactional
public class UserServiceProxy {
    private UserService userService;
    public UserServiceProxy(UserService userService){
        this.userService=userService;
    }
    public void add(){
        System.out.println("静态代理 开启事务");
        userService.add();
        System.out.println("静态代理 关闭事务");
    }
}
